import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'

import Home from '@/views/home.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: 'list/all',
    children: [
      {
        path: 'list/:category',
        name: 'ArticleList',
        component: () => import('@/views/list.vue')
      },
      {
        path: 'detail/:id',
        name: 'ArticleDetail',
        component: () => import('@/views/detail.vue')
      },
      {
        path: 'tags',
        name: 'TagList',
        component: () => import('@/views/tags.vue')
      },
      {
        path: 'resources',
        name: 'ResourceList',
        component: () => import('@/views/resources.vue')
      },
      {
        path: 'archives',
        name: 'ArchiveList',
        component: () => import('@/views/archives.vue')
      },
      {
        path: 'about',
        name: 'AboutList',
        component: () => import('@/views/about.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
